$(function(){
	var r = GetQueryString('r');
		$('#result').text(r);	
});
function GetQueryString(name)
{
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = decodeURI(window.location.search).substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
function setIfOpen(val) {
    document.cookie = "ifOpen=" + val;
  }

  function getIfOpenVal(param) {
    var strCookie = document.cookie;
    var arrCookie = strCookie.split(";");
    for (var i = 0; i < arrCookie.length; i++) {
      var arr = arrCookie[i].split("=");
      if (arr[0] == param)
        return arr[1];
    }
    return null;
  }
//收缩服务
var ifOpen = getIfOpenVal("ifOpen");

// index页面默认展开浮窗
if(ifOpen == 0){
  $(".business-bridge-iframe").animate({
    left : "-230px",
  }, 0)
  $(".js-shrink-button").find("span").removeClass("control").text("服务指导");
  
  $(".js-shrink-button").toggle(function() {
    $(".business-bridge-iframe").animate({
      left : "0px",
    }, 1000)
    $(this).find("span").addClass("control").text("收起");
    setIfOpen(1);
  }, function() {

    $(".business-bridge-iframe").animate({
      left : "-230px",
    }, 1000)
    $(this).find("span").removeClass("control").text("服务指导");
    setIfOpen(0);
  })
}else{

  $(".js-shrink-button").toggle(function() {
    $(".business-bridge-iframe").animate({
      left : "-230px",
    }, 1000)
    $(this).find("span").removeClass("control").text("服务指导");
    setIfOpen(0);
  }, function() {

    $(".business-bridge-iframe").animate({
      left : "0px",
    }, 1000)
    $(this).find("span").addClass("control").text("收起");
    setIfOpen(1);
  })

}